/*
 * author      : 吴中勤 
 * date        : 2018/8/16
 * description : adapter manager 负责管理多个 adapter
 *
 */

package com.deepexi.adapter.converter;

import com.deepexi.adapter.converter.erp.MobyEventHandler4Erp;
import com.deepexi.adapter.converter.sap.MobyEventHandler4Sap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ConverterManagerImpl implements ConverterManager {

    @Autowired
    private MobyEventHandler4Sap mobyEventHandler4Sap;

    private MobyEventHandler4Erp mobyEventHandler4Erp;

    public MobyEventHandler getMobyEventHandler(ConverterType converterType) {
        switch (converterType) {
            case SAP:
                return mobyEventHandler4Sap;
            case ERP:
                return mobyEventHandler4Erp;
            default:
                throw new RuntimeException("不支持的adapter");
        }
    }

    @Override
    public MobyEventHandler getDefaultMobyEventHandler() {
        return mobyEventHandler4Sap;
    }
}
